let chren = args.form;
chren.forEach(function(item,index,array){
  let id = item.id;
  lib.dbUpdate('UPDATE receipt_product SET reflecti = IF(reflecti IS NULL,0, reflecti) + IF(quantity_inspection IS NULL,0,quantity_inspection) WHERE id = ? AND del_flag = 0', id); 
  lib.dbUpdate('UPDATE receipt_product SET low_quality = ( IF(low_quality IS NULL,0,low_quality) -  IF(quantity_inspection IS NULL,0,quantity_inspection)) WHERE id = ? AND del_flag = 0',id); 
  lib.dbUpdate('UPDATE receipt_product SET no_qc_num = ( IF(low_quality IS NULL,0,low_quality) +  IF(reflecti IS NULL,0,reflecti)) WHERE id = ? AND del_flag = 0',id); 
  lib.dbUpdate('UPDATE receipt_product SET qc_status = (case WHEN reflecti <=> 0 THEN 0  WHEN reflecti > 0 AND low_quality > 0 THEN 2 WHEN reflecti > 0 AND low_quality = 0 THEN 3 ELSE 0 END) WHERE id = ? AND del_flag = 0', id); 
});
1
